package com.example.message.enums;

/**
 * 目标类型枚举
 */
public enum TargetType {
    
    USER(1, "个人"),
    ROLE(2, "角色"),
    DEPT(3, "部门"),
    POSITION(4, "岗位"),
    ALL(5, "全体");
    
    private final Integer code;
    private final String desc;
    
    TargetType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }
    
    public Integer getCode() {
        return code;
    }
    
    public String getDesc() {
        return desc;
    }
    
    public static TargetType getByCode(Integer code) {
        for (TargetType type : values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }
        return null;
    }
}